
###############################################################################
# Name:         entry
# Purpose:      GUI-entry for weak(PyQt5)
# Author:       Bright Li
# Modified by:
# Created:      2019-02-23
# Version:      [0.1.1]
# RCS-ID:       $$
# Copyright:    (c) Bright Li
# Licence:
###############################################################################

import sys, traceback
from PyQt5.QtWidgets import QApplication

from frw.glob import GlobMnger
from frw import log
logger = log.make_logger(__file__)

def qt5_program_run(AnyVacClass, *args):
    try:
        app = QApplication(sys.argv)

        mainwin = AnyVacClass(*args)
        mainwin.show()

        sys.exit(app.exec_())
    except Exception as e:
        if GlobMnger.get("LOGGER_LEVEL") <= 20:  # logging.INFO
            traceback.print_exc()
        else:
            logger.error(e)
        sys.exit(-1)
